#pragma once

#include <stddef.h>
#include "Detour/Include/DetourNavMesh.h"
#include "Detour/Include/DetourNavMeshQuery.h"
#include "RecastDemo/Include/MeshHeaderDef.h"
#include "Detour/Include/DetourCommon.h"

#define MMO_FREE_NAVMESH(p)    \
if (p != nullptr) {           \
    dtFreeNavMesh(p);         \
    p = nullptr;              \
}                               

#define MMO_FREE_NAVMESHQUERY(p) \
if (p != nullptr) {             \
    dtFreeNavMeshQuery(p);      \
    p = nullptr;                \
}

bool g_LoadNavMeshByRawFile(const char* filePath, dtNavMesh** navMesh);

bool g_LoadNavMeshByRawStream(const char* rawstr, size_t length, dtNavMesh** navMesh);

bool g_LoadNavMeshByJsonFile(const char* filePath, dtNavMesh** navMesh);

bool g_LoadNavMeshByJsonStream(const char* filePath, const char* jsonstr, dtNavMesh** navMesh);

//bool g_LoadNavMeshByBsonFile(const char* filePath, dtNavMesh** navMesh);

bool g_ConvertNavMeshToRawFile(const dtNavMesh* navMesh, const char* filePath);

bool g_ConvertNavMeshFromJsonFileToRawFile(const char* srcJsonFilePath, const char* dstRawFilePath);

//bool g_ConvertNavMeshFromBsonFileToRawFile(const char* srcJsonFilePath, const char* dstRawFilePath);

//bool g_ConvertNavMeshToJsonFile(const dtNavMesh* navMesh, const char* filePath);

//bool g_ConvertNavMeshFromRawFileToJsonFile(const char* srcRawFilePath, const char* dstJsonFilePath);
